package com.htudata.core.util.operation;

import org.apache.commons.lang3.ArrayUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ArrayOperationUtils {

  public static boolean isValidArr(Object[] arr) {
    if (arr != null && 
      arr.length > 0)
      return true; 
    return false;
  }
  
  public static <K> List<K> arrToList(Object[] arr) {
    List<K> result = new ArrayList<>(Arrays.asList((K[])arr));
    return result;
  }
  
  public static <T> void arrCopy(Object[] srcArr, Object[] tgtArr) {
    System.arraycopy(srcArr, 0, tgtArr, 0, srcArr.length);
  }
  
  public static <K> void deleteArrEle(Object[] arr, int index) {
    ArrayUtils.remove(arr, index);
  }
}
